<%@page pageEncoding="GBK"%>
<%@page contentType="text/html; charset=GBK"%>
<%@ include file="../bas/common.jsp"%>
<HTML><HEAD><TITLE></TITLE></HEAD>
<body onLoad="init();" style="border:0px">
<p:tree
      name="t"
      useCheckboxSystem = "true"
      showPseudoElement = "true"
      rootCaption="?"
      useFolderIcon = "false"
      dataList="list"
      idField="id"
      parentIdField="parentid"
      captionField="caption"
      checkboxValueField="checkboxvalue"
 />

<script>
function getAuthList()
{
	var j = document.all.length;
	var s = "";
	for(var i=0;i<j;i++)
	{
		if (document.all(i).type == "checkbox")
		{
			if (document.all(i).checked)
				s += s==""?document.all(i).checkboxValue:","+document.all(i).checkboxValue;
			else
				s += s==""?"~":","+"~";
		}
	}
	return s;
}

function expandAll(treeElm)
{
	if (typeof(treeElm) == 'undefined') treeElm = t._pseudoElement;
	for (var i=0; i<treeElm._children.length; i++)
	{
		treeElm._children[i].open(true);
		expandAll(treeElm._children[i]);
	}
}

function collapseAll()
{
	t.elementCloseWalkDown();
}

function selectAll()
{
	checkboxAll("",2);
}

function clearAll()
{
	checkboxAll("",0);
}

function checkboxAll(treeElm,value)
{
	if ((typeof(treeElm) == 'undefined') || treeElm == "")
		treeElm = t._pseudoElement;
	for (var i=0; i<treeElm._children.length; i++)
	{
		treeElm._children[i].setCheckboxValue(value,false,false);
		checkboxAll(treeElm._children[i],value);
	}
}
</script>